package com.appspot.urlheap.data;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Link;
import com.google.appengine.api.datastore.Text;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Item {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long   id;

	@Persistent
	private Link   url;

	@Persistent
	private String title;

	@Persistent
	private Text   desc;

	@Persistent
	private String user;
	
	@Persistent
	private Long   date;

	public Item(Link url, String title, Text desc, String user) {
		this.url = url;
		this.title = title;
		this.desc = desc;
		this.user = user;
		this.date = System.currentTimeMillis();
	}

	public Item(Link url, String title, Text desc, String user, Long date) {
		this.url = url;
		this.title = title;
		this.desc = desc;
		this.user = user;
		this.date = date;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Link getUrl() {
		return url;
	}

	public void setUrl(Link url) {
		this.url = url;
	}

	public Text getDesc() {
		return desc;
	}

	public void setDesc(Text desc) {
		this.desc = desc;
	}

	public void setUser(String user) {
		this.user = user;
	}

	public String getUser() {
		return user;
	}

	public void setDate(Long date) {
	    this.date = date;
    }

	public Long getDate() {
	    return date;
    }
}
